window.onload = () => {

    let btn = document.querySelector("button");
    let btn_post = document.querySelector("#btn_post");

    btn.addEventListener('click', (e) => {
        e.preventDefault();
        let username = document.getElementById("username").value;
        let password = document.getElementById("password").value;
        axios.get("http://172.19.1.251:8080/login", {
            params: {
                username: username,
                password: password
            }
        })//发送get请求
            .then(res => {
            console.log(res.data)
        })//获得请求的响应
    })

    btn_post.addEventListener("click", (e) => {
        e.preventDefault();
        let username = document.getElementById("username").value;
        let password = document.getElementById("password").value;
        axios.post("http://172.19.1.251:8080/login", {
            username: username,
            password: password
        }).then(res => {
            console.log(res.data)//获得请求的响应
        })
    })
}